CMAKE_MINIMUM_REQUIRED(VERSION 3.10)

SET(SERVER_INCLUDE_DIR
        "${CMAKE_NFSHM_SOURCE_DIR}/game/NFGameCommon"
        "${CMAKE_NFSHM_SOURCE_DIR}/game/NFGameCommon/RecastNavigation")

if (UNIX)
#[[    add_definitions(
            -Werror=format
    )]]
endif ()

include_directories( ${INCLUDE_DIR} ${SERVER_INCLUDE_DIR})

# 始终编译NFGameCommon（游戏公共库）
ADD_SUBDIRECTORY("NFGameCommon")

# 根据CMAKE_BUILD_GAME变量选择性编译特定游戏项目
if (CMAKE_BUILD_GAME)
    message(STATUS "============================================================")
    message(STATUS "开始编译游戏项目: ${CMAKE_BUILD_GAME}")
    message(STATUS "============================================================")
    
    # 检查游戏目录是否存在
    if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_BUILD_GAME}/CMakeLists.txt")
        ADD_SUBDIRECTORY("${CMAKE_BUILD_GAME}")
        message(STATUS "成功添加游戏项目: ${CMAKE_BUILD_GAME}")
    else()
        message(WARNING "游戏项目目录不存在或没有CMakeLists.txt: ${CMAKE_BUILD_GAME}")
        message(STATUS "可用的游戏项目：LieRen, ShouYou, TestGame")
    endif()
else()
    message(STATUS "CMAKE_BUILD_GAME未设置，不编译任何游戏项目")
endif()


